﻿@{
    ViewBag.Title = "OtherWorkReocred";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model DepartmentWork.Model.ProjectWorkReocredViewModel
<div class="page-header">
    <div class="pull-left">
        <ol class="breadcrumb visible-sm visible-md visible-lg">
            <li><a href="@Url.Action("Index", "Home", new { area = "" })"><i class="icon fa fa-home"></i>主页</a></li>
            <li><a href="@Url.Action("Index", "Project", new { area = "ProjectManageArea" })"><i class="fa fa-envelope"></i>项目模块</a></li>
            <li class="active"><a href="#"><i class="fa fa-envelope"></i>工作记录</a></li>

        </ol>
    </div>
</div>

<style>
   ul>.active {
       font-weight:bold
   }
   #table_WorkReocredInfo td {
       padding-top: 8px
   }

</style>
<script>
    window.onload = function ()
    {
        //$("#datetimepicker").datepicker();

        //$("#datetimepicker2").datepicker();

    };



</script>
<script>

    function DelWorkReocred(workReocredId)
    {
        if (!confirm("请确认是否删除该工作记录？"))
        {
            return false;
        }
        window.location.href = '@Url.Action("DelWorkReocred", "WorkReocred", new { area = "ProjectManageArea" })' + '?workReocredId=' + workReocredId;
    }
</script>

@{
    if (ViewBag.CreateProjectFlag == "True")
    {
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;项目添加成功！</strong>
    </div>
    }
    if (ViewBag.CreateProjectFlag == "False")
    {
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;项目添加失败！</strong> @ViewBag.Info
    </div>
    }
}

<div class="row">
    <div class="col-lg-12">
        <div class="panel">
            <div class="panel-heading bk-bg-primary">
                <h6><i class="fa fa-table red"></i><span class="break"></span>工作记录列表</h6>
                    <div class="panel-actions">
                        <a data-toggle="modal" data-target="#div_CreateProjectWorkReocred" class="bk-margin-5 btn btn-default  btn-sm" style="background-color: #ECEDF0">&nbsp;&nbsp;新增工作记录&nbsp;&nbsp;</a>
                    </div>
            </div>
            <div class="panel-body">
                <div class="tabs">
                    <ul class="nav nav-tabs">
                         <li class="active">
                            <a href="#all" style="color:black" data-toggle="tab">全部</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div id="all" class="tab-pane active">
                            <div class="panel-body">
                                <div class="table-responsive">
                                    <table class="table table-hover">
                                        <thead>
                                            <tr>
                                                <th style="width: 15%">工作记录创建日期</th>
                                                <th style="width: 20%">工作记录名称</th>
                                                <th style="width: 40%">工作内容</th>
                                                <th style="width: 15%">工作记录人</th>
                                                <th style="width: 10%">操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                           @{
                                                if (this.Model.NormalProjectWorkAllList.Tables[0].Rows.Count != 0)
                                                {
                                                    for (int i = 0; i < this.Model.NormalProjectWorkAllList.Tables[0].Rows.Count; i++)
                                                    {
                                                        var item = this.Model.NormalProjectWorkAllList.Tables[0].Rows[i];
                                                        <tr>
                                                             <td style="color: black">@Convert.ToDateTime(item["PROJECT_WORKRECORD_CREATETIME"]).ToString("yyyy-MM-dd")</td>
                                                            <td><a style="color:cornflowerblue;cursor: pointer" data-toggle="modal" data-target="#WorkReocredInfoModal" onclick="ShowWorkReocredInfoModal('@item["PROJECT_WORKRECORD_ID"]')">@item["PROJECT_WORKRECORD_TITLE"]</a></td>
                                                            <td style="color: black">@item["PROJECT_WORKRECORD_CONTENT"].ToString()</td>
                                                            <td style="color: black">@item["CREATER_NAME"]</td>
                                                            <td style="color: black">
                                                                <a style="color:cornflowerblue" onclick="ShowWorkReocredEditModal('@item["PROJECT_WORKRECORD_ID"]')" data-toggle="modal" data-target="#div_EditProjectWorkReocred">编辑</a>
                                                                &nbsp; &nbsp; &nbsp;
                                                                <a style="color:cornflowerblue" class="a_DeleteBug" onclick="DelWorkReocred('@item["PROJECT_WORKRECORD_ID"]')">删除</a>
                                                            </td>
                                                        </tr>
                                                    }
                                                }
                                            }

                                        </tbody>
                                    </table>
                                </div>
                                <div class="bk-margin-5 btn-group" style="float: right">
                                    @Html.ShowPageNavigate((int)ViewData["pageIndex"], (int)ViewData["pageSize"], (int)ViewData["total"])
                                </div>
                            </div>
                        </div>
                         
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>




<!-- 模态框（Modal） -->

<div class="modal fade" id="div_CreateProjectWorkReocred" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <link href="~/Assets/plugins/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
    <script src="~/Assets/plugins/bootstrap-select/bootstrap-select.min.js"></script>
    <link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker3.css" rel="stylesheet" />
    <link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker-theme.css" rel="stylesheet" />
    <script src="~/Assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script src="~/Assets/plugins/chosen/chosen.jquery.min.js"></script>
    <script src="~/Assets/js/pages/form-elements.js"></script>

    <script>

        window.onload = function ()
        {
            $("#datetimepicker").datepicker({
                autoclose: true,
                pickerPosition: "bottom-right"
            });
            $("#datetimepicker2").datepicker({
                autoclose: true,
                pickerPosition: "bottom-right"
            });
        };

        function SubmitCreate()
        {
            var length = $("#tb_ProjectWorkReocredDescription").text().length;

            //return false;
            var message = "";
            if ($("#tb_ProjectWorkReocredTitle").val() == "" || $.trim($("#tb_ProjectWorkReocredTitle").val()) == "")
            {
                message += " · 工作记录标题不能为空" + "<br/>";
            }

            if (length > 200)
            {
                message += " · 工作记录内容字符不能超过200个" + "<br/>";
            }
            if ($("#tb_ProjectWorkReocredDescription").val() == "")
            {
                message += " · 工作记录内容不能为空" + "<br/>";
            }
            if (message != "")
            {
                $("#lb_CheckCreateWorkReocredMessage").html(message);
                $("#div_CheckCreateWorkReocredMessage").css("display", "block");
                return false;
            }
            else
            {
                $("#lb_CheckCreateWorkReocredMessage").html("");
                $("#div_CheckCreateWorkReocredMessage").css("display", "none");
                $("#frm_CreateProjectWorkReocred").submit();
            }
        }


    </script>

    <style>
        .btn-default {
            color: #333;
            background-color: #FFF;
            border-color: #CCC;
            height: 34px;
        }
    </style>
    <div class="modal-dialog">
        <div class="modal-content">
            <form id="frm_CreateProjectWorkReocred" action="@Url.Action("CreateWorkReocred", "WorkReocred", new { area = "ProjectManageArea" })" method="POST">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">新增工作记录
                    </h4>
                </div>
                <div id="div_CreateProject" class="modal-body">
                    <div class="alert alert-danger" id="div_CheckCreateWorkReocredMessage" style="display: none">
                        <button type="button" class="close" data-dismiss="alert">×</button>
                        <strong>
                            <label id="lb_CheckCreateWorkReocredMessage"></label>
                        </strong>
                    </div>

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">记录主题</label>
                        <div class="col-md-9">
                            <input id="tb_ProjectWorkReocredTitle" style="border-color: cornflowerblue"
                                name="tb_ProjectWorkReocredTitle" class="form-control" placeholder="Text"
                                type="text">
                            <span class="span_ProjectWorkReocredTitle"></span>
                        </div>
                    </div>
                    <br />


                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">描述：</label>
                        <div class="col-md-9">
                            <textarea id="tb_ProjectWorkReocredDescription" name="tb_ProjectWorkReocredDescription" rows="5" class="form-control" placeholder="Content.."></textarea>
                        </div>
                    </div>

                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label">发生日期：</label>
                        <div class="col-md-9">
                            <div class="input-append date" id="datetimepicker" data-date="@DateTime.Now.ToString("yyyy-MM-dd")" data-date-format="yyyy-mm-dd">
                                <input disabled="disabled" name="tb_ExecuteTime" style="border-color: cornflowerblue" class="form-control" size="16" type="text" value="@DateTime.Now.ToString("yyyy-MM-dd")">
                                <span class="add-on"><i class="icon-th"></i></span>
                            </div>
                            <span class="span_DevelopDescription"></span>
                        </div>
                    </div>

                    <br />


 

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <input type="button" onclick="SubmitCreate()" value="新增" class="btn btn-primary" />
                </div>
            </form>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>